package com.sc.nft.entity.congestive;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.sc.nft.entity.PropGift;
import com.sc.nft.entity.dto.AddEquityPropsGiftDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
/**
 * 新增权益道具,转增配置的充血模型
 */
@Data
public class EquityPropsCT {

    @ApiModelProperty(value = "转增数据")
    private List<PropGift> propGifts;


    public void transition(AddEquityPropsGiftDTO list, Long propId) {
        if (CollUtil.isEmpty(propGifts)) {
            propGifts = new ArrayList<>();
        }
        if (ObjectUtil.isNotNull(list.getBalanceConsume())) {
            PropGift propGift = new PropGift();
            propGift.setPropId(propId);
            propGift.setConsumeType(2);
            propGift.setQuantityConsume(list.getBalanceConsume().toString());
            propGifts.add(propGift);
        }

        if (ObjectUtil.isNotNull(list.getDebrisConsume())) {
            PropGift propGift1 = new PropGift();
            propGift1.setPropId(propId);
            propGift1.setConsumeType(1);
            propGift1.setQuantityConsume(list.getDebrisConsume().toString());
            propGifts.add(propGift1);
        }

        if (ObjectUtil.isNotNull(list.getEcologyConsume())) {
            PropGift ecologyConsume = new PropGift();
            ecologyConsume.setPropId(propId);
            ecologyConsume.setConsumeType(3);
            ecologyConsume.setQuantityConsume(list.getEcologyConsume().toString());
            propGifts.add(ecologyConsume);
        }
    }
}
